//
//  EightChapterViewController.m
//  CoreAnimation
//
//  Created by 张国文 on 16/10/27.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "EightChapterViewController.h"
#import "RepeatAndDurationViewController.h"
#import "BeginTimeAndTimeOffsetAndSpeedViewController.h"
#import "OPenAndCloseTheDoorViewController.h"

@interface EightChapterViewController ()

@end

@implementation EightChapterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIButton *firstButton = [UIButton buttonWithType:UIButtonTypeCustom];
    firstButton.frame = CGRectMake(0, 20, 360, 50);
    [firstButton setTitle:@"durationAndRepeat" forState:UIControlStateNormal];
    [firstButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    firstButton.tag = 100;
    [firstButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:firstButton];
    
    UIButton *sectionButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sectionButton.frame = CGRectMake(0, 70, 360, 50);
    [sectionButton setTitle:@"beginTimeAndSpeedAndTimeOffset" forState:UIControlStateNormal];
    [sectionButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sectionButton.tag = 101;
    [sectionButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sectionButton];
   
    UIButton *thirdButton = [UIButton buttonWithType:UIButtonTypeCustom];
    thirdButton.frame = CGRectMake(0, 120, 300, 50);
    [thirdButton setTitle:@"开门关门" forState:UIControlStateNormal];
    [thirdButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    thirdButton.tag = 102;
    [thirdButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:thirdButton];
}

- (void)clickJump:(UIButton *)button
{
    switch (button.tag) {
        case 100:
        {
            RepeatAndDurationViewController *repeatAndDurationVC = [[RepeatAndDurationViewController alloc] init];
            [self.navigationController pushViewController:repeatAndDurationVC animated:YES];
            break;
        }
        case 101:
        {
            BeginTimeAndTimeOffsetAndSpeedViewController *beginTimeVC = [[BeginTimeAndTimeOffsetAndSpeedViewController alloc] init];
            [self presentViewController:beginTimeVC animated:YES completion:nil];
            break;
        }
        case 102:
        {
            OPenAndCloseTheDoorViewController *openAndCloseTheDoorVC = [[OPenAndCloseTheDoorViewController alloc] init];
            [self.navigationController pushViewController:openAndCloseTheDoorVC animated:YES];
            break;
        }
        default:
            break;
    }
}

@end
